function mog = init_mog(X,C)
% creates a structure and fills in the initial parameter 
% values. The parameters are X, the data matrix, and C, 
% the desired number of mixture components.
% 
% 2012 Maarten Inja & Chiel Kooijman. 

x_min = min(X(:, 1));
x_max = max(X(:, 1));
y_min = min(X(:, 2));
y_max = max(X(:, 2));

% make sure sigmas are not too big
sigma_denominator = 20*C;
sigma = [(x_max - x_min)/sigma_denominator 0 ; 0 (y_max - y_min)/sigma_denominator];

% choose C number of mus randomly and gaurantee that they are unique
mus = zeros(1, C);
while size(unique(mus, 'rows'), 1) != C
    mus = X(floor( rand(C, 2) * size(X,1)) + 1);
end

for i = 1:C 
    mog{i}.MU = mus(i, :);
    mog{i}.SIGMA = sigma;
    mog{i}.PI = 1/C;
end

